package com.hps.webservice.config;

import com.hps.webservice.service.TestService;
import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.xml.ws.Endpoint;

/**
 * @author hepengshuai
 * @date 2018/12/7 20:49
 */
@Configuration
public class CxfConfig {

    @Autowired
    private Bus bus;

    @Autowired
    private TestService testService;

    @Bean
    public Endpoint endpoint() {
        EndpointImpl endpoint = new EndpointImpl(bus, testService);
        endpoint.getInInterceptors().add(new AuthInterceptor());
        endpoint.publish("/TestService");
        return endpoint;
    }

    @Bean
    public Endpoint endpoint1() {
        EndpointImpl endpoint = new EndpointImpl(bus, testService);
        endpoint.publish("/TestService1");
        return endpoint;
    }
}
